<?php 
	$config = Zend_Registry::get('config');
	$userData = $this->loggedInUser();
if ($userData == null) {
//Not loggedIn
	?>
	
	<div id="homeAd">
	<div id="homeL"></div>
	<div id="homeR"></div>
</div>
<div id="homeSignup">
<a id="signup" href="<?php echo $this->url(array('controller'=>'user','action'=>'register'),"default",true);?>"></a>
</div>

<div id="homeInfo">
<div id="homeInfoInner">
<div id="homeLeft">
<h1 class="home" style="width:600px;"><span style="float:left;">What's Happening around this area ...</span> 
<span id="totalBooks">
<a href="<?php echo $this->url(array('controller'=>'book','action'=>'list'),"default",true); ?>">
<?php //echo $this->totalBooks;?>
</a>
</span></h1>
<ul class="activities">
<?php //echo $this->activityList($this->activities,true); ?>
</ul>
</div>

<div id="homeRight" style="float:right;">

<?php echo $this->blogRss();?>

<?php
//echo $this->userThumbnailList($this->topUsers); ?>
<?php
// echo $this->bookThumbnailList($this->randomBooks); ?>
 
<h1 class="home" id="tFollowUs">Follow us</h1>
<ul class="thumbnails">
<div class="dotline"></div>
<div id="folowUs">
<a title="Follow us on facebook" style="float:left;" href="http://www.facebook.com/#!/pages/heyidlebookscom/147660101959143"><img src="<?php echo $config->baseurl.'/img/followfb.jpg';?>"></img></a>
<a title="Follow us on twitter" style="float:left;margin-left:10px;" href="https://twitter.com/#!/heyidlebooks"><img src="<?php echo $config->baseurl.'/img/followt.jpg';?>"></img></a>
</div>
<div class="dotline"></div>
</ul>
 



</div>
</div>

<?php }else {
//LoggedIn

	$user = $this->user;
	$userbook_cnt = count(User::getBooks($user,UserBookStatus::AVAILABLE));
?>
<div id="homeLeft">
<?php if($userbook_cnt==0 || empty($user->introduction) || empty($user->big_img)){ ?>
<div id="tips"> ^_^
<?php if($userbook_cnt==0){ //No book added ?>
Haven't added a book yet? Try to <a href="<?php echo $this->url(array('controller'=>'book','action'=>'fetch'),"default",true); ?>">add a book</a>, let others know!
<?php } else if(empty($user->big_img)){?>
How's your look? Do you look friendly? <a href="<?php echo $this->url(array('controller'=>'user','action'=>'settings'),"default",true); ?>">Upload your picture</a> to get more trust! 
<?php } else if(empty($user->introduction)){?>
Tell others more about you, e.g Where do you live? What kind of books are you interested? <br />Go to 
<a href="<?php echo $this->url(array('controller'=>'user','action'=>'settings'),"default",true); ?>">Settings</a> page to edit.
<?php }?>
</div>
<?php }?>
<h1 class="home" style="width:600px;"><span style="float:left;">What's Happening around this area ...</span> 
<span id="totalBooks" >
<a href="<?php echo $this->url(array('controller'=>'book','action'=>'list'),"default",true); ?>">
<?php //echo $this->totalBooks;?>
</a>
</span></h1>
<ul class="activities">
<?php //echo $this->activityList($this->activities,true); ?>
</ul>
</div>

<div id="homeRight" style="float:right;">
<h1 class="home"><span style="float:left;"><?php echo $user->name;?></span>
<a href="<?php echo $this->url(array('controller'=>'user','action'=>'profile'),"default",true); ?>" style="float:right;font-size:11px;letter-spacing:0;line-height:11px;margin-top:11px;">More</a></h1>
<ul class="thumbnails">
<div class="dotline"></div>
<div class="actImg">
	<img src="<?php echo $this->userThumbnail($this->user); ?>"/>
	<?php 
$uc = User::checkUserAuthProvider($user, AuthProvider::FACEBOOK);
if (!empty($uc)) {
?><a target="_blank" id="fbIcon" title="<?php echo $user->name;?> has connected with Facebook, isn't he/she more trustworthy? Click to check out!" href="http://www.facebook.com/profile.php?id=<?php echo $uc->auth_uid;?>">
fb</a>
<?php }?>
</div>
<div style="float:left;margin-left:3px;width:175px;font-size:11px;padding-top:5px;line-height:20px;">
<?php echo $this->userLocation($this->user); ?>
<br />
<a href="<?php echo $this->url(array("controller"=>"user", "action"=>"profilebooks", "uid"=>$this->user->id), null, true);?>">
Books (<?php echo $userbook_cnt;?>)</a><br />
<a id="addABookSmall"  href="<?php echo $this->url(array('controller'=>'book','action'=>'fetch'),"default",true); ?>">Add a Book</a>
</div>
<div class="dotline"></div>
</ul>

<?php  echo $this->blogRss();?>

<?php
//echo $this->userThumbnailList($this->topUsers); ?>
<?php
 //echo $this->bookThumbnailList($this->randomBooks); ?>

<h1 class="home" id="tFollowUs">Follow us</h1>
<ul class="thumbnails">
<div class="dotline"></div>
<div id="folowUs">
<a title="Follow us on facebook" style="float:left;" href="http://www.facebook.com/#!/pages/heyidlebookscom/147660101959143"><img src="<?php echo $config->baseurl.'/img/followfb.jpg';?>"></img></a>
<a title="Follow us on twitter" style="float:left;margin-left:10px;" href="https://twitter.com/#!/heyidlebooks"><img src="<?php echo $config->baseurl.'/img/followt.jpg';?>"></img></a>
</div>
<div class="dotline"></div>
</ul>


</div>
</div>
<?php }?>